﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BUS;
using DAO;
using FDeal.WUC;
using System.Drawing;

namespace FDeal
{
    public partial class MemberInfo_Index : System.Web.UI.Page
    {
        ThongTinTaiKhoanBUS tt = new ThongTinTaiKhoanBUS();
        THONGTINTAIKHOAN taikhoan = DangNhap.current;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadThongTinCaNhan();
            }
        }
        
        private void LoadThongTinCaNhan()
        {
            HoTen.Text = taikhoan.HOTEN;
            DienThoai.Text = taikhoan.DIENTHOAI;
        }

        protected void btnCapNhat_Click(object sender, ImageClickEventArgs e)
        {          
            //Cap nhat                       
            taikhoan.HOTEN = HoTen.Text;
            taikhoan.DIENTHOAI = DienThoai.Text;

            bool kq = tt.Sua(taikhoan);
            if (kq)
            {
                lbError.ForeColor = Color.Green;
                lbError.Text = "Cập nhật thành công";
            }
            else
            {
                lbError.ForeColor = Color.Red;
                lbError.Text = "Cập nhật thất bại";
            }
        }
    }
}